#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<limits.h>

void queue(char phone[][11],int n);
int judge(char phone[][11],int n);
void find_before(char phone[][11],int n);

int main(void)
{
	int n;
	char phone[100][11];
	
	scanf("%d",&n);
	getchar(); 
	for(int i=0;i<n;i++){
		gets(phone[i]);
	}
	
	queue(phone,n);
	if(judge(phone,n)){
		printf("Ok\n");
	}
	else{
		find_before(phone,n);
	}
	return 0;
}

void queue(char phone[][11],int n){
	char swap[11];
	for(int i=1;i<n;i++){
		for(int j=0;j<n-i;j++){
			if(strcmp(phone[j],phone[j+1])>0){
				strcpy(swap,phone[j]);
				strcpy(phone[j],phone[j+1]);
				strcpy(phone[j+1],swap);
			}
		}
	}
}

int judge(char phone[][11],int n){
	int len;
	for(int i=0;i<n-1;i++){
		len=strlen(phone[i]);
		if(!strncmp(phone[i],phone[i+1],len)){
			return 0;
		}
	}
	return 1;
}

void find_before(char phone[][11],int n){
	int len;
	for(int i=0;i<n-1;i++){
		len=strlen(phone[i]);
		if(!strncmp(phone[i],phone[i+1],len)){
			printf("%s\n",phone[i]);
		}
	}
}
